<?php
    require_once $_site->get_handlepath('device');

	$id = request('id',false,true,false,0);
    $obj=new gas();
    $ginfo=$obj->getGas($id);
    if(empty($ginfo))exit('no data');

	require_once("header.php");
	require_once $_site->get_handlepath('admin');
	$xinfo=admin_fun_find_admin($ginfo['xid']);

	$rtn_car=array('挖机','渣车','压路机','推土机','公用车辆','其他设备');
	if(1!=$cookie['id'] && $ginfo['xid']!=$cookie['id'])exit('no right');
?>

	<script type="text/javascript" charset="utf-8">
		loader.file({
			plugin:['dialog/main','my97/wdatepicker'],
			skincss:['list']
		})

		function agree(){
			$.post("/handle.php",$("#form1").serialize(),function(res){
				if(res.state){
					parent.change(res.info);
					return;
				}
				alert(res.msg);
				},'json');
		}
	</script>
	<style type="text/css">
		.table td a.hover{display: line-block;background: #60D277;color: #ffffff;padding:5px;}
	</style>
</head>
<body>
	<div class="main">
      <form action="/handle.php" method="post" id="form1">
      <input type="hidden" name="h" value="gas/editinfo">
      <input type="hidden" name="id" value="<?php echo $id?>">

        <table cellpadding="0" cellspacing="1" border="0" class="table">
          <tr style="display: none;">
		     <td valign="top" style="height:200px;width:50%;padding:2px;">
			   <img src="<?php echo $ginfo['img_start'];?>" width="387px" height="257px">
			 </td>
			 <td valign="top" style="height:200px;padding:2px;">
			 <img src="<?php echo $ginfo['img_end'];?>" width="387px" height="257px">
			 </td>
		  </tr>

            <tr>
                <td colspan="2" style="text-align: center;height:150px;width:50%;padding:2px;">
                    <a href="<?php echo $ginfo['img_start'];?>" target="_blank"><img src="<?php echo $ginfo['img_start'];?>" width="160px" height="125px"></a>
                    <a href="<?php echo $ginfo['img_end'];?>" target="_blank"><img src="<?php echo $ginfo['img_end'];?>" width="160px" height="125px"></a>
                    <?php if($ginfo['img_three']){ ?>
                        <a href="<?php echo $ginfo['img_three'];?>" target="_blank"><img src="<?php echo $ginfo['img_three'];?>" width="160px" height="125px"></a>
                    <?php } ?>
                    <?php if($ginfo['img_four']){ ?>
                        <a href="<?php echo $ginfo['img_four'];?>" target="_blank"><img src="<?php echo $ginfo['img_four'];?>" width="160px" height="125px"></a>
                    <?php } ?>
                </td>
            </tr>

          <tr>
		     <td>
			   加油前油表数：<input style="width:220px" type="text" name="num_start" value="<?php echo $ginfo['num_start'];?>">
			 </td>
			 <td>
			 加油后油表数：<input style="width:220px" type="text" name="num_end" value="<?php echo $ginfo['num_end'];?>">
			 </td>
		  </tr>

          <tr>
		     <td>
			   加油员编号：<input style="width:220px" type="text" name="gaser" value="<?php echo $ginfo['gaser'];?>">
			 </td>
			 <td>
			 油罐编号：<input style="width:220px" type="text" name="gascan" value="<?php echo $ginfo['gascan'];?>">
			 </td>
		  </tr>

		  <?php if(1==$ginfo['type']){ ?>
          <tr>
			 <td>加油设备编号：<input style="width:220px" type="text" name="carno" value="<?php echo $ginfo['carno'];?>"></td>
			 <td>车辆类型：
			     <select style="float:none;" name="cartype">
			       <option value="">=请选择=</option>
			       <?php foreach($rtn_car as $vo){ ?>
			       <option value="<?php echo $vo;?>"<?php echo $vo==$ginfo['cartype']?' selected':''?>><?php echo $vo; ?></option>
			       <?php } ?>
			     </select>
			 </td>
		  </tr>
		  <?php } ?>

          <tr>
		     <td>
			   油价：<input style="width:220px" type="text" name="price" value="<?php echo $ginfo['price']>0?$ginfo['price']:'';?>">
			 </td>
			 <td>
			 金额：<?php echo $ginfo['sum']>0?$ginfo['sum']:'--' ?>
			 </td>
		  </tr>

			<?php if($cookie['group']!=12){?>
			<tr>
				<td colspan="2" style="text-align:center;">
                      <input type="button" value="修  改" class="button1" onclick="agree()">&nbsp;&nbsp;
				</td>
			</tr>
			<?php }?>

		</table>
	</form>
	</div>
</body>
</html>
